/*
*
* Copyright (c) 2011 Vaulting Systems International
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy 
* of this software and associated documentation files (the "Software"), to deal 
* in the Software without restriction, including without limitation the rights 
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
* of the Software, and to permit persons to whom the Software is furnished to do  
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all  
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE  
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package com.ekeymanlib.ws;

import java.util.List;

import com.ekeymanlib.business.KeyManager;
import com.ekeymanlib.dto.AppDeviceApiKeys;
import com.ekeymanlib.dto.AppDeviceGrid;
import com.ekeymanlib.dto.SearchFilter;
import com.ekeymanlib.dto.VendorProfile;

/*
 * Web service Facade used by unit tests.
 */
public class EkeymanAdminWS{
	
	public EkeymanAdminWS(){}
	
	private KeyManager keyManager;
	
	public void registerUser(String apiKey, String openidurl){
		getKeyManager().registerUser(apiKey, openidurl);
	}
	
	public String registerVendor(String name, 
			String address, String city, String state, String zip, 
			String phone, String emailAddress){
		
		return getKeyManager().registerVendor( 
				name, address, city, state,
				zip, phone, emailAddress);
	}
		
	public AppDeviceApiKeys generateNewPrivateKey(String publicKey, String apiKey){
		
		return getKeyManager().generateNewPrivateKey(publicKey, apiKey);
	}
	
	public void updateVendor(String apiKey, String name, 
			String address, String city, String state,
			String zip, String phone, String emailAddress){
		
		getKeyManager().updateVendor(apiKey, name, address, city, state,
				zip, phone, emailAddress);
	}
	
	public void deleteVendor(String apiKey){
	
		getKeyManager().deleteVendor(apiKey);
	}
	
	public void deleteUser(String openidurl){
		
		getKeyManager().deleteUser(openidurl);
	}

	public VendorProfile getVendorProfile(String apiKey){
		
		return getKeyManager().getVendorProfile(apiKey);
	}
	
	public long getAppDeviceCount(List<SearchFilter> searchFilters){
		return getKeyManager().getAppDeviceCount(searchFilters);
	}
	
	public List<AppDeviceGrid> findAppDevices(List<SearchFilter> searchFilters, 
			String sortIndex, String sortOrder, int firstResult, int maxResults) {
		return getKeyManager().findAppDevices(searchFilters, sortIndex, sortOrder, firstResult, maxResults);
	}

	public void setKeyManager(KeyManager keyManager) {
		this.keyManager = keyManager;
	}

	public KeyManager getKeyManager() {
		return keyManager;
	}

}
